package com.example.function.project.model.pojo;


import com.example.common.support.ApplicationContextProvider;
import com.example.function.project.model.one.Project;
import com.example.function.project.service.IProjectService;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Description: <ProjectPojo vo>. <br>
 * <p>
 * generate time:2021-7-27 14:47:24
 *
 * @author hanqf
 * @version V1.0
 */
@Data
public class ProjectPojo implements Serializable {
    private static final long serialVersionUID = 1L;

    /*
     * 项目id
     */
    private Long id;


    /*
     * 项目代号，支持数字、字符及特殊字符，限制50字符
     */
    private String projectName;


    /*
     * 项目阶段id
     */
    private Long projectStageId;


    /*
     * 全功能开发完成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private java.util.Date projectCompletionDate;


    /*
     * SOP截止时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private java.util.Date projectSopDate;


    /*
     * 创建时间
     */
    private java.util.Date projectCreatetime;


    /*
     * 修改时间
     */
    private java.util.Date projectModifytime;


    /*
     * 创建人id
     */
    private Integer projectUserId;


    /**
     * 实体对象复制到数据对象
     */
    public static ProjectPojo wrapper(Project project) {
        ProjectPojo projectPojo = new ProjectPojo();
        BeanUtils.copyProperties(project, projectPojo);
        final IProjectService projectService = (IProjectService) ApplicationContextProvider.getBean("projectService");

        return projectPojo;
    }

    /**
     * 实体对象复制到数据对象List
     */
    public static List<ProjectPojo> wrapper(List<Project> projectList) {
        List<ProjectPojo> projectPojoList = new ArrayList<>();
        for (Project project : projectList) {
            projectPojoList.add(ProjectPojo.wrapper(project));
        }
        return projectPojoList;
    }

}



